<?php
$table=new Table();
$manage = new Manage();
$managarr=$manage->select();
$mid=isset($mid)?$mid:0;
$navcat = new Catalog(array('id_str' => 'id', 'pid_str' => 'parent_catalog','cur_id'=>$mid,
                'item_fn'=>create_function('$item',
                                    'return sprintf(\'<span class="fl"><a href="editmanage.php?act=alt&amp;mid=%d">%s</a></span>'.
                                    '<span class="fr"><a class="btn" href="editmanage.php?act=del&amp;mid=%d">删除</a>'.
                                    '<a class="btn" href="editmanage.php?act=add&amp;mid=%d">建立子目录</a></span>\','.
                                    '$item[\'id\'],$item[\'cat_name\'],$item[\'id\'],$item[\'id\']);')
                )
    );
?>

<div class="prinavw">

    <ul class="prinav">
        <li class="prinavli">
            <div class="prinavtit">
                <h2><strong><a href="<?php echo SITEDIR?>/admin/">首页</a></strong></h2>
            </div>

        </li>
        <li class="prinavli">

            <div class="prinavtit">
                <h2><strong>设置</strong>  </h2>
            </div>
            <div class="prinavdet">
                <dl>
                    <dt><span class="fl" >表设置</span><span class="fr"><a class="btn" href="edittable.php?act=add">添加表</a></span></dt>
                    <dd>
                        <dl>
                            <?php
                            foreach ($table->select() as $v) {
                                printf('<dt title="%s">'.
                                       '<a class="fl" href="editfiled.php?tid=%d">%s</a>'.
                                       '<span class="fr"><a class="btn" href="edittable.php?act=del&tid=%d">删除</a></span>'.
                                       '</dt>',
                                    $v['table_desc'],
                                    $v['id'],$v['table_desc'],
                                    $v['id']
                                );
                            }
                            ?>
                        </dl>
                    </dd>
                    <dt>
                        <a href="editattach.php">附带发布设置</a>
                    </dt>
                    <dt>
                        <a href="editfile.php">文件管理设置</a>
                    </dt>
                    <dt>
                        <a href="">附件设置</a>
                    </dt>
                </dl>

            </div>
        </li>
        <li class="prinavli">

            <div class="prinavtit">
                <h2><strong class="fl">导航</strong> <span class="fr"><a  class="btn" href="editmanage.php?act=add">新建根目录</a></span></h2>
            </div>
            <div class="prinavdet">
                <?php echo  $navcat->get($managarr);  ?>
            </div>

        </li>
        <li class="prinavli">
            <div class="prinavtit">
                <h2><strong>发布</strong></h2>
            </div>
            <div class="prinavdet">
                <?php
                $navcat->setparm(array('item_fn'=> create_function('$item','return sprintf(\'<a href="editpublish.php?mid=%s">%s</a>\',$item["id"],$item["cat_name"]);'),
                                'cur_id'=>$mid));
                echo  $navcat->get($managarr);
                ?>
            </div>
        </li>
    </ul>
</div>